#include<iostream>
using namespace std;
int main()
{
	char ch = getchar();
	while (ch != '$')
	{
		while (ch != '$' && ch != '\n')
		{
			switch (ch)
			{
			case '#':Pop(&my_stack);
				break;
			case '@':Clear(&my_stack);
				break;
			default:Push_Stack(&my_stack);
				break;
			}
			ch=getchar();
		}
		Destory(&my_stack);
		ch=getchar();
	}
	return 0;
}